<template>
  <div class="index-wrap">
    <div class="index-left">
      <div class="index-left-block">
        <h2>全部产品</h2>
        <template v-for="product in productList">
          <h3>{{product.title}}</h3>
          <ul>
            <li v-for="item in product.list">
              <a :href="item.url">{{item.name}}</a>
              <span v-if="item.hot" class="hot-tag">HOT</span>
            </li>
          </ul>
          <div v-if="!product.last" class="hr"></div>
        </template>
      </div>
      <div class="index-left-block lastest-news">
        <h2>最新消息</h2>
        <ul>
          <li v-for="item in newsList">
            <a :href="item.url" class="new-item">{{item.title}}</a>
          </li>
        </ul>
      </div>
    </div>
    <div class="index-right">
      <SlideShow :slides="slides" :inv="slideSpeed" @onchange="doSomethingOnSlideChange"></SlideShow>
      <div class="index-board-list">
        <div class="index-board-item"
             v-for="(item,index) in boardList"
             :class="[{'line-last' : index % 2 !== 0},'index-board-' + item.id]">
          <div class="index-board-item-inner">
            <h2>{{item.title}}</h2>
            <p>{{item.description}}</p>
            <div class="index-board-button">
              <a class="button">立即加入</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import SlideShow from '../components/slideShow'

export default {
  components : {
    SlideShow
  },
  created : function() {
    /*this.$http.get('api/getNewsList').then((res) => {
      this.newsList = res.data
    },(err) => {
      console.log(err)
    })*/
  },
  methods : {
    doSomethingOnSlideChange () {

    }
  },
  data () {
   return {
     slideSpeed : 2000,
     slides : [
       {
         src : require('../assets/slideShow/pic1.jpg'),
         title :'Dortmund',
         href : 'detail/analysis'
       },
       {
         src : require('../assets/slideShow/pic2.jpg'),
         title :'Real Madrid',
         href : 'detail/count'
       },
       {
         src : require('../assets/slideShow/pic3.jpg'),
         title :'Barcelona',
         href : 'http://xxx.xx.com'
       },
       {
         src : require('../assets/slideShow/pic4.jpg'),
         title :'Bayern',
         href : 'detail/forecast'
       },
       {
         src : require('../assets/slideShow/pic5.jpg'),
         title :'Juventus',
         href : 'detail/forecast'
       },
       {
         src : require('../assets/slideShow/pic6.jpg'),
         title :'acmilan',
         href : 'detail/forecast'
       },
       {
         src : require('../assets/slideShow/pic7.jpg'),
         title :'roma',
         href : 'detail/forecast'
       },
       {
         src : require('../assets/slideShow/pic8.jpg'),
         title :'milano',
         href : 'detail/forecast'
       }
     ],
     boardList : [
       {
         title : '多特蒙德',
         description : '主场:威斯特法伦球场（德语:Westfalen）。',
         id : 'dortmund',
         saleout : false
       },
       {
         title : '皇家马德里',
         description : '主场:伯纳乌球场（西班牙语:Estadio Santiago Bernabéu）。',
         id : 'realMadrid',
         saleout : false
       },
       {
         title : '巴塞罗那',
         description : '主场:诺坎普球场（Camp Nou）。',
         id : 'barcelona',
         saleout : true
       },
       {
         title : '拜仁慕尼黑',
         description : '主场:慕尼黑安联球场（Allianz Arena）。',
         id : 'bayern',
         saleout : false
       },
       {
         title : '尤文图斯',
         description : '主场:尤文图斯球场（Juventus Stadium）。',
         id : 'juventus',
         saleout : false
       },
       {
         title : 'AC米兰',
         description : '主场:圣西罗球场（Stadio Giuseppe Meazza）。',
         id : 'acmilan',
         saleout : false
       },
       {
         title : '罗马',
         description : '主场:罗马奥林匹克球场（Stadio Olimpico di Roma）。',
         id : 'roma',
         saleout : false
       },
       {
         title : '国际米兰',
         description : '主场:梅阿查体育场（Stadio Giuseppe Meazza）。',
         id : 'milano',
         saleout : false
       }
     ],
     newsList : [
       {
         title : '数据统计',
         url : 'http://starcraft.com'
       },
       {
         title : '数据预测',
         url : 'http://warcraft.com'
       },
       {
         title : '流量分析',
         url : 'http://overwatch.com',
         hot : true
       },
       {
         title : '广告发布',
         url : 'http://hearstone.com'
       }
     ],
     productList : {
       pc : {
         title : 'PC产品',
         list : [
           {
             name : '数据统计',
             url : 'http://starcraft.com'
           },
           {
             name : '数据预测',
             url : 'http://warcraft.com'
           },
           {
             name : '流量分析',
             url : 'http://overwatch.com',
             hot : true
           },
           {
             name : '广告发布',
             url : 'http://hearstone.com'
           }
         ]
       },
       app : {
         title : '手机应用类',
         last : true,
         list : [
           {
             name : '91助手',
             url : 'http://weixin.com'
           },
           {
             name : '产品助手',
             url : 'http://twitter.com'
           },
           {
             name : '智能地图',
             url : 'http://maps.com',
             hot : true
           },
           {
             name : '团队语音',
             url : 'http://phone.com'
           }
         ]
       }
     }
   }
 }
}
</script>

<style scoped>
.index-wrap {
  width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}
.index-left {
  float: left;
  width: 300px;
  text-align: left;
}
.index-right {
  float: right;
  width: 900px;
}
.index-left-block {
  margin:15px;
  background: #fff;
  box-shadow: 0 0 1px #ddd;
}
.index-left-block h2 {
  background: #4fc08d;
  color: #fff;
  padding:10px 15px;
  margin-bottom: 20px;
}
.index-left-block h3 {
  padding:0 15px 5px 15px;
  font-weight: bold;
  color: #222;
}
.index-left-block ul {
  padding:10px 15px;
}
.index-left-block li {
  padding:5px;
}
.index-board-list {
  overflow: hidden;
}
.index-board-item {
  float: left;
  width: 400px;
  background: #fff;
  box-shadow: 0 0 1px #ddd;
  padding:20px;
  margin-right: 20px;
  margin-bottom: 20px;
}
.index-board-item-inner {
  min-height: 125px;
  padding-left: 120px;
}
.index-board-dortmund .index-board-item-inner {
  background: url("../assets/images/1.png") no-repeat;
}
.index-board-realMadrid .index-board-item-inner {
  background: url("../assets/images/2.png") no-repeat;
}
.index-board-barcelona .index-board-item-inner {
  background: url("../assets/images/3.png") no-repeat;
}
.index-board-bayern .index-board-item-inner {
  background: url("../assets/images/4.png") no-repeat;
}
.index-board-juventus .index-board-item-inner {
  background: url("../assets/images/5.png") no-repeat;
}
.index-board-acmilan .index-board-item-inner {
  background: url("../assets/images/6.png") no-repeat;
}
.index-board-roma .index-board-item-inner {
  background: url("../assets/images/7.png") no-repeat;
}
.index-board-milano .index-board-item-inner {
  background: url("../assets/images/8.png") no-repeat;
}
.index-board-item h2 {
  font-size: 18px;
  font-weight: bold;
  color: #000;
  margin-bottom: 15px;
}
.line-last {
  margin-right: 0;
}
.index-board-button {
  margin-top: 20px;
}
.lastest-news {
  min-height: 512px;
}
.hot-tag {
  background: red;
  color: #fff;
}
.new-item {
  display: inline-block;
  width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
